package com.example.blog.demos.web.service;

import com.example.blog.demos.web.mapper.BlogInfoMapper;
import com.example.blog.demos.web.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 实现接收到的请求（调用链接数据库的类方法）
 * @author Q
 * @create 2025-06-20-16:20
 */
@Service
public class BlogService {
    @Autowired
    private BlogInfoMapper blogInfoMapper;

    public List<BlogInfo> getList() {
        return blogInfoMapper.selectAll();
    }

    public BlogInfo getBlogDetail(Integer blogId) {
        return blogInfoMapper.selectById(blogId);
    }

    public Integer insertBlog(BlogInfo blogInfo) {
        return blogInfoMapper.insertBlog(blogInfo);
    }

    public Integer update(BlogInfo blogInfo) {
        return blogInfoMapper.updateBlog(blogInfo);
    }
}
